package com.chexiehui.jc.realm;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.chexiehui.jc.entity.CarInfo;
import com.chexiehui.jc.model.SearchHistory;
import com.chexiehui.jc.jpush.JpushMessage;

import com.chexiehui.jc.realm.CarInfoDao;
import com.chexiehui.jc.realm.SearchHistoryDao;
import com.chexiehui.jc.realm.JpushMessageDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig carInfoDaoConfig;
    private final DaoConfig searchHistoryDaoConfig;
    private final DaoConfig jpushMessageDaoConfig;

    private final CarInfoDao carInfoDao;
    private final SearchHistoryDao searchHistoryDao;
    private final JpushMessageDao jpushMessageDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        carInfoDaoConfig = daoConfigMap.get(CarInfoDao.class).clone();
        carInfoDaoConfig.initIdentityScope(type);

        searchHistoryDaoConfig = daoConfigMap.get(SearchHistoryDao.class).clone();
        searchHistoryDaoConfig.initIdentityScope(type);

        jpushMessageDaoConfig = daoConfigMap.get(JpushMessageDao.class).clone();
        jpushMessageDaoConfig.initIdentityScope(type);

        carInfoDao = new CarInfoDao(carInfoDaoConfig, this);
        searchHistoryDao = new SearchHistoryDao(searchHistoryDaoConfig, this);
        jpushMessageDao = new JpushMessageDao(jpushMessageDaoConfig, this);

        registerDao(CarInfo.class, carInfoDao);
        registerDao(SearchHistory.class, searchHistoryDao);
        registerDao(JpushMessage.class, jpushMessageDao);
    }
    
    public void clear() {
        carInfoDaoConfig.clearIdentityScope();
        searchHistoryDaoConfig.clearIdentityScope();
        jpushMessageDaoConfig.clearIdentityScope();
    }

    public CarInfoDao getCarInfoDao() {
        return carInfoDao;
    }

    public SearchHistoryDao getSearchHistoryDao() {
        return searchHistoryDao;
    }

    public JpushMessageDao getJpushMessageDao() {
        return jpushMessageDao;
    }

}
